package me.baicai.weixin.application;



import java.util.List;


/**
 * @description:
 * @author: [ 超级大白菜 ]
 * @date: 2019-11-09 8:45
 */
public class BasicController
{

    public Result success()
    {
        return this.success("提交成功");
    }

    public Result success(String message)
    {
        return new Result().success(message);
    }

    public Result error(String message)
    {
        return new Result().error(message);
    }

    public Result error()
    {
        return new Result().error();
    }

    public Result response(int code, String message)
    {
        return new Result(code, message);
    }

    public Result success(Result result)
    {
        return new Result(result);
    }

    public Result toList(List list)
    {
        if (list == null)
            return error("没有数据");
        else
        {
            Result Result = new Result(200, list);
            Result.setTotal(list.size());
            return Result;
        }
    }

}
